package com.cy.service;

import com.cy.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Collection;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author cy
 * @since 2021-11-08
 */
public interface UserService extends IService<User> {

    User findUserById(int userId);


    /**
     * 注册用户
     * @param user
     * @return
     */
    Map<String, Object> register(User user);


    /**
     * 激活账号
     * @param userId    用户id
     * @param code      激活码
     * @return
     */
    int activation(String userId, String code);

    /**
     * 登录
     * @param username
     * @param password
     * @param expiredSeconds
     * @return
     */
    Map<String, Object> login(String username, String password, int expiredSeconds);


    /**
     * 退出登录
     * @param ticket   登录凭证
     * @return
     */
    Boolean logout(String ticket);


    /**
     * 根据id 修改用户的头像路径
     * @param id
     * @param headerUrl
     * @return
     */
    Boolean updateHeader(Integer id, String headerUrl);


    public Collection<? extends GrantedAuthority> getAuthorities(int userId);

}
